import {defineStore} from "pinia";
import {ref} from "vue";

export const useMenuStore = defineStore('menu', () => {
    let menuDataList = ref([]);
    let addOrUpdateDialog = ref(false);
    let deleteDialog = ref(false);
    let menuIcons = ref([]);
    let parentMenuList = ref([]);
    let menuRoleAuthorisationDialog = ref(false);

    function setMenuDataList(info) {
        menuDataList.value = info;
    }

    function resetAddOrUpdateDialog(flag) {
        addOrUpdateDialog.value = flag;
    }

    function resetDeleteDialog(flag) {
        deleteDialog.value = flag;
    }

    function resetMenuIcons(icons) {
        menuIcons.value = icons;
    }

    function resetParentMenuList(menuList) {
        parentMenuList.value = menuList;
    }

    function resetMenuRoleAuthorisationDialog(flag) {
        menuRoleAuthorisationDialog.value = flag;
    }

    return { menuDataList, addOrUpdateDialog, deleteDialog, menuIcons, parentMenuList, menuRoleAuthorisationDialog,
        setMenuDataList, resetAddOrUpdateDialog, resetDeleteDialog, resetMenuIcons, resetParentMenuList, resetMenuRoleAuthorisationDialog }
})